package com.lk.auth.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;

/**
 * @author liangk
 * @create 2019年 04月 03日
 **/
public class BrowerAuthenticationConfig {
    @Autowired
    protected AuthenticationSuccessHandler formAuthenticationSuccessHandler;

    @Autowired
    protected AuthenticationFailureHandler formAuthenticationFailureHandler;

    public void configure(HttpSecurity http) throws Exception {
        http.formLogin()
                .loginPage("/authentication/from")
                .loginProcessingUrl("/authentication/from")
                .successHandler(formAuthenticationSuccessHandler)
                .failureHandler(formAuthenticationFailureHandler);
    }
}
